<template>
  <div class="head">
    <header class="navbar">
      <div class="logo"></div>

      <nav class="menu">
        <ul>
          <li v-for="item in navs" :key="item.name">
            <button @click="liClick(item)">{{ item.title }}</button>
          </li>
        </ul>
      </nav>

      <div class="name"></div>
    </header>
  </div>
</template>

<script setup>
import { useRouter } from "vue-router";
const router = useRouter();

const navs = [
  { title: "小工具", path: "/tools", name: "tools" },
  { title: "文档", path: "/hoom/docs", name: "hoom_docs" },
  { title: "收藏书签", path: "/hoom/bookmarks", name: "hoom_bookmarks" },
];

const liClick = (item) => {
  router.replace({ name: item.name });
};
</script>

<style scoped lang="scss">
.head {
  position: relative;
  background-image: linear-gradient(to top,
      transparent 0,
      var(--top-color) 100%);
  transition: --top-color calc(var(--color-swap-duration) + 0.6s) var(--color-swap-timing-function);
}

.navbar {
  width: 100%;
  max-width: 68.75rem;
  padding: 10px 30px;
  height: 75px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: 50px 1fr 1fr;
  align-items: center;

  .logo {
    width: 100%;
    height: 100%;
    background: url(@/assets/logo.svg) no-repeat;
    background-size: auto 70%;
    background-position: center;
  }

  .menu {
    ul {
      display: flex;
      align-items: center;

      button {
        flex-direction: column;
        height: 3rem;
        color: var(--color-text);
        font-weight: var(--font-weight-light);
        font-size: 1rem;
        -webkit-text-decoration: none;
        text-decoration: none;
        text-transform: capitalize;
        padding: 0 1rem;
        background: none;
        border: none;
        cursor: pointer;
      }
    }
  }
}
</style>